package com.ziq.baselib.test.viewpager

import android.annotation.SuppressLint
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.ziq.base.base.BaseActivity
import com.ziq.base.extension.binding
import com.ziq.baselib.databinding.ActivityViewpagerBinding
import com.ziq.baselib.test.hilt.HiltFragment
import dagger.hilt.android.AndroidEntryPoint
import java.io.*


@AndroidEntryPoint
class ViewPagerActivity : BaseActivity() {

    private val binding : ActivityViewpagerBinding by binding()

    @SuppressLint("SetTextI18n")
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding.root
        binding.viewpager.adapter = MyAdapter(this)
    }

    class MyAdapter(fragmentActivity: FragmentActivity) : FragmentStateAdapter(fragmentActivity) {
        override fun getItemCount(): Int {
            return 10
        }

        override fun createFragment(position: Int): Fragment {
            return HiltFragment()
        }

    }
}